package org.testis.webautomationmodule.ui.objects;

import org.testis.logging.AtofLogLevel;
import org.testis.webautomationmodule.ui.UIBehaviorDecorator;


public class WaitForPopup extends UIBehaviorDecorator
{

    private String id;
    private String timeout;


    public WaitForPopup(String id,
                        String timeout)
    {
        setId(id);
        setTimeout(timeout);
    }


    @Override
    protected boolean setBehavior()
    {
        try {
            getWebAutomationImpl().waitForPopUp(id,
                                                timeout);
            putLog(" passed waiting for popup to load with id " + getId() +
                   " timeout " +
                   getTimeout() + ". Popup loaded...",AtofLogLevel.DEBUG);
        } catch (Exception ex) {
            putLog(" failed waiting for popup to load with id " + getId() +
                   " timeout " +
                   getTimeout() + ". Popup not loaded...",AtofLogLevel.ERROR);
        }
        return true;

    }


    public String getId()
    {
        return id;
    }


    public void setId(String val)
    {
        this.id = val;
    }


    public String getTimeout()
    {
        return timeout;
    }


    public void setTimeout(String val)
    {
        this.timeout = val;
    }
}

